package com.wb.core08_常用类.泛类;

/**
 * @author 黄衡熙
 * @version 1.0
 */
public class Test02 {

    public static void main(String[] args) {
        Person person = new Person("admin", 20);
        Person person2 = new Person("jack", 22);
        Person person3 = new Person("lucy", 18);
        if (person.compareTo(person2) > 0) {
            System.out.println(person.getName() + "的年龄比" + person2.getName() + "大");
        } else if (person.compareTo(person2) == 0) {
            System.out.println(person.getName() + "的年龄与" + person2.getName() + "一样大");
        } else {
            System.out.println(person.getName() + "的年龄比" + person2.getName() + "小");
        }
        System.out.println("**************************");
        if (person.compareTo(person3) > 0) {
            System.out.println(person.getName() + "的年龄比" + person3.getName() + "大");
        } else if (person.compareTo(person3) == 0) {
            System.out.println(person.getName() + "的年龄与" + person3.getName() + "一样大");
        } else {
            System.out.println(person.getName() + "的年龄比" + person3.getName() + "小");
        }
        System.out.println("**************************");
        User user = new User("admin", 20);
        User user2 = new User("jack", 20);
        if (user.compareTo(user2) > 0) {
            System.out.println(user.getName() + "大");
        } else if (user.compareTo(user2) < 0) {
            System.out.println(user2.getName() + "大");
        } else {
            System.out.println("两个人一样大");
        }

    }

}